﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using WCFMINERP.InnerFactoryContracts.DataContracts;
using WCFMINERP.InnerFactory.Presenter;
using WCFMINERP.COM;
using System.ServiceModel;

namespace WCFMINERP.InnerFactory.Forms
{
    public partial class FrmActive : Form
    {
        LoginPresenter _presenter = new LoginPresenter();

        public FrmActive()
        {
            InitializeComponent();
        }

        private void btnActive_Click(object sender, EventArgs e)
        {
            OutProcessShop_Info osInfo = _presenter.GetOutShopByActiveCode(txtActive.Text.Trim());
            InnerFactoryParameter.OutProcessShopInfo = osInfo;//去全局变量赋值
            if (osInfo != null)
            {
                Properties.Settings.Default.FactoryId = osInfo.OutShopId;
                Properties.Settings.Default.Save();
                FrmLogin frm = new FrmLogin();
                frm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("激活码无效！","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }
    }
}
